 <meta charset="utf-8">
 <div class="box box-primary" id="app_authMenu_add" style="max-width: 1200px;"> 
            <form role="form"  id="editForm" class="form-horizontal" >
            <div class="box-body" > 
            <div class="form-group">
					<label for="name" class="col-sm-2 control-label" >所属应用</label>
					<div class="col-sm-10">
                  		<select id="appKey" v-model="authMenu.appKey" name="appKey" v-kselect="{url:'auth/authApp/loadAuthAppComboboVo',vmodel:'authMenu.appKey',firstEmpty:'false'}" class=" form-control"   required> </select>
					</div>
				</div> 
				
				 <div class="form-group">
					<label for="name" class="col-sm-2 control-label" >所属模块</label>
					<div class="col-sm-10">
					 <input type="hidden" name="moduleId" v-model="authMenu.moduleId" class="form-control" id="moduleId" required />
                     <input type="text" name="moduleName" v-model="authMenu.moduleName" class="form-control" id="moduleName" placeholder="请从选择关联权限编辑" required disabled="disabled" />
					</div>
				</div> 
				
			  <div class="form-group" >
                  <label for="parentName" class="col-sm-2 control-label" > 父级菜单</label>
                  <div class="col-sm-8">
                     <input type="hidden" name="parentId" v-model="authMenu.parentId" class="form-control" id="parentId" required />
                     <input type="text" name="parentName" v-model="authMenu.parentName" class="form-control" id="parentName" placeholder="请选择父级菜单" required disabled="disabled" />
                  </div>
                  <div class="col-sm-2">
					<button type="button" class="btn btn-default" v-on:click="chooseParent">查找选取</button>
				 </div>
              </div>
              
			 <div class="form-group" >
                  <label for="name" class="col-sm-2 control-label" >菜单名称</label>
                  <div class="col-sm-10">
                   <input type="text" name="name" v-model="authMenu.name" class="form-control" id="name" placeholder="请输入菜单名称" required />
                   </div>
              </div>
				
			 <div class="form-group" >
			  	<label for="permissionName" class="col-sm-2 control-label" >关联权限</label> 
			  	<div class="col-sm-8">
				 <input type="hidden" v-model="authMenu.permissionId" name="permissionId" id="permissionId">
				 <input type="text" name="permissionName" v-model="authMenu.permissionName" class="form-control"	id="permissionName" disabled="disabled">
				</div>
				<div class="col-sm-2">
				<button type="button" class="btn btn-default" v-on:click="choosePermission">查找选取</button>
				</div>
			</div>
			
				 <div class="form-group">
	                  <label for="enabled"  class="col-sm-2 control-label" >菜单状态</label>
	                  <div class="col-sm-10">
	                   <select v-model="authMenu.enabled" name="enabled" id="enabled" class="form-control"  required >
					    <option  value="true">启 用</option>
					    <option value="false">禁 用</option>
					  </select>
					  </div>
                </div>
			 
			 		<div class="form-group">
	                  <label for="type" class="col-sm-2 control-label" >菜单类型</label>
	                   <div class="col-sm-10">
	                    <select v-model="authMenu.type" id="type" name="type" class="form-control"  required >
					     <option  value="G">分组</option>
					     <option  value="M">菜单</option>
					   </select>
					  </div>
                </div>
			 
			   <div class="form-group" id="iconcls_div">
                  <label for="iconcls"  class="col-sm-2 control-label" >显示图标</label>
                  <div class="col-sm-10">
                   <input type="text" name="iconcls" v-model="authMenu.iconcls" class="form-control" id="iconcls" placeholder="请输入显示图标" />
              	  </div>
               </div>
                
               <div class="form-group" id="iconcls_div">
                  <label for="iconcls" class="col-sm-2 control-label" >显示顺序</label>
                  <div class="col-sm-10">
                 	 <input type="text" name="showIndex" v-model="authMenu.showIndex" class="form-control" id="showIndex" placeholder="请输入显示顺序" />
             	  </div>
               </div>
               
			   <div class="form-group" id="description_div">
                  <label for="description" class="col-sm-2 control-label">备注</label>
                  <div class="col-sm-10">
                  	<input type="text" name="description" v-model="authMenu.description" class="form-control" id="description" placeholder="请输入备注" />
             	 </div>
               </div>
           </div>
           <div class="box-footer">
                 <button type="button" class="btn btn-default" v-on:click="cancle">取消</button>
                 <button type="button" class="btn btn-info pull-right"  v-on:click="add">提交</button>
              </div> 
               </form>
               
<script type="text/javascript">
var news= new Vue({
    el: '#app_authMenu_add',
    data: {
    	authMenu:{
    		id: undefined,
    		name: undefined,
    		iconcls: undefined,
    		type: undefined,
    		parentId: undefined,
    		parentName: undefined,
    		moduleId: undefined,
    		permissionId: undefined,
    		permissionName: undefined,
    		appKey: undefined,
    		showIndex: undefined,
    		description: undefined
    	},
    	bus:new Vue()
     },
     mounted:function(){
     },
     methods: {
    	 add: function () {
    	    	if($("#editForm").valid()){
    	    		let _this=this;
    	    		let url="auth/authMenu/addAuthMenu";
    	    		zfesAjax.ajaxTodo(url,_this.$data.authMenu, function(data){
    	    			alertSwal.successText(data.message);
    	    			layer.close(layer.index);
    	    		})
    	    	}
    	    },
    	    chooseParent: function(){
    	    	let _this=this;
    	    	let appKey=_this.authMenu.appKey;
    	    	if(!appKey){
    	    		alertSwal.warningText("请选择所属应用");
    	    		return;
    	    	}
    	    	let url="/view/auth/authMenu/authMenu.lookback.html";
    	    	zfesLayerEditDg.lookback(url, {}, "选择父级菜单", 400, function() {
    	    		let param = zfesLayerEditDg.getCallBackParam();
    	    		if(param){
    	    			_this.$data.authMenu.parentId=param.id;
    	    			_this.$data.authMenu.parentName=param.name;
    	    		}
    	    	})
    	    },
    	    choosePermission: function(){
    	    	let _this=this;
    	    	let appKey=_this.authMenu.appKey;
    	    	if(!appKey){
    	    		alertSwal.warningText("请选择所属应用");
    	    		return;
    	    	}
    	    	let url="/view/auth/authMenu/authMenu.prem.lookback.html";
    	    	let param={appKey:appKey}
    	    	zfesLayerEditDg.lookback(url,param, "选择关联权限", 600, function() {
    	    		let param = zfesLayerEditDg.getCallBackParam();
    	    		if(param){
    	    			_this.authMenu.moduleName=param.moduleName;
    	    			_this.authMenu.moduleId=param.moduleId;
    	    			_this.authMenu.permissionId=param.id;
    	    			_this.authMenu.permissionName=param.name;
    	    			console.log(JSON.stringify(_this.authMenu));
    	    		}
    	    	})
    	    },
    	    cancle:function(){
    	    	 layer.close(layer.index);
    	    }
    }
});
 </script>
</div>